﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    学生管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("AdminTopUc", "学生管理"); %>
    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table03">
        <% using (Ajax.BeginForm("StudentListUc", new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "listDiv", }))
           {%>
        <tr class="box06">
            <td width="10%" height="27" align="center">
                <div align="right">
                    院校 :
                </div>
            </td>
            <td width="13%" align="center" class="bg3">
                <div align="left">
                    <select name="CollegeIdSearch" id="CollegeIdSearch">
                        <option value="0">请选择</option>
                    </select>
                </div>
            </td>
            <td width="11%" align="center">
                <div align="right">
                    系别 :</div>
            </td>
            <td width="16%" align="center" class="bg3">
                <div align="left">
                    <select name="DepartIdSearch" id="DepartIdSearch">
                        <option value="0">请选择</option>
                    </select>
                </div>
                <div align="left">
                </div>
            </td>
            <td width="11%" align="center">
                <div align="right">
                    专业 :</div>
            </td>
            <td width="16%" align="center" class="bg3">
                <div align="left">
                    <select name="SubjectIdSearch" id="SubjectIdSearch">
                        <option value="0">请选择</option>
                    </select>
                </div>
                <div align="left">
                </div>
            </td>
            <td align="center" class="box06">
                <div align="right">
                    班别 :</div>
            </td>
            <td align="center" class="bg3">
                <div align="left">
                    <select name="ClassIdSearch" id="ClassIdSearch">
                        <option value="0">请选择</option>
                    </select>
                </div>
            </td>
        </tr>
        <tr class="box06">
            <td height="27" align="center">
                <div align="right">
                    学生学号 :</div>
            </td>
            <td align="left" class="bg3">
                <input name="uidSearch" type="text" size="18" id="uidSearch" />
            </td>
            <td align="center">
                <div align="right">
                    姓名 :</div>
            </td>
            <td colspan="" align="center" class="bg3">
                <div align="left">
                    <input name="nameSearch" type="text" size="18" id="nameSearch" />
                </div>
                <div align="left">
                </div>
            </td>
            <td height="27" align="center">
                <div align="right">
                    审核状态 :</div>
            </td>
            <td align="left" class="bg3" colspan="">
                <select name="isReview">
                    <option value="-1">请选择</option>
                    <option value="0">未审核</option>
                    <option value="1">通过</option>
                    <option value="2">未通过</option>
                </select>&nbsp;
            </td><td height="27" align="center">
                <div align="right">
                    年级 :</div>
            </td>
            <td align="left" class="bg3" colspan="">
               <%=Html.DropDownList("YearIdSearch", StudentHelper.GetGradeYear())%>
                <input type="submit" value="查询" />
            </td>  
        </tr>
        <% } %>
    </table>
    <table width="100%" height="5" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
        <tr>
            <td height="5" bgcolor="#FFFFFF">
            </td>
        </tr>
    </table>
    <div id="listDiv">
        <% Html.RenderAction("StudentListUc"); %>
    </div>
    <div align="center">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td height="42">
                    <% using (Html.BeginForm("ImportStudent", "Admin", FormMethod.Post, new { id = "importForm", enctype = "multipart/form-data" }))
                       { %>
                    <div align="center">
                        <input type="button" id="btnAdd" value="新增学生" />
                        &nbsp;
                        <%=Html.ActionButton("下载模板","StudentTemplateDown") %>
                        &nbsp;
                        <%--<input type="button" id="btnImport" onclick="testFile();" value="导入学生" />--%>
                        导入:<input name="fileField" type="file" size="5" style="display: " id="fileField"
                            onchange="this.form.submit();" />
                        &nbsp;
                        <input type="button" id="btnDel" value="删除学生" />
                        &nbsp;
                        <input type="button" id="btnExport" value="导出学生" />
                        &nbsp;
                        <input type="button" id="btnReview" value="审核注册" />
                    </div>
                    <%} %>
                </td>
            </tr>
        </table>
    </div>
    <div id="editDiv" title="编辑学生">
    </div>
    <div id="reviewDiv" title="审核注册">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <script type="text/javascript">
        var testFile = function () {
            $("#fileField").click();
        };

        var testChange = function () {
            //alert(4);
            $("#importForm").submit();
        };

        $(function () {
            selectLoad("CollegeIdSearch", "Ajax/GetCollege");
            selectChangeLoad("DepartIdSearch", "CollegeIdSearch", "Ajax/GetDepart/");
            selectChangeLoad("SubjectIdSearch", "DepartIdSearch", "Ajax/GetSubject/");
            selectChangeLoad("ClassIdSearch", "SubjectIdSearch", "Ajax/GetClass/");

            selectChangeLoadDef("CollegeIdSearch", "SubjectIdSearch", "Ajax/GetSubject/", "ClassIdSearch", "Ajax/GetClass/");
            selectChangeLoadDef("DepartIdSearch", "ClassIdSearch", "Ajax/GetClass/");
            /* $("#fileField").change(function () {
            //alert(11);
            $("#importForm").submit();
            });*/

            $("#editDiv").dialog({
                autoOpen: false,
                height: 450,
                width: 550,
                modal: true,
                close: function () {
                    window.location.reload();
                }
            });
            $("#reviewDiv").dialog({
                autoOpen: false,
                height: 100,
                width: 300,
                modal: true,
                close: function () {
                }
            });

            $("#btnAdd")
			.click(function () {
			    $("#editDiv").html("loading...");
			    $("#editDiv").load(appRoot + 'Admin/StudentEditUc/' + "?rd=" + rdTime());
			    $("#editDiv").dialog("open");
			});

            allCheckEvent("allCheck", "idCheckBox");

            $("#btnReview").click(function () {
                var ids = getCheckStr("idCheckBox", ",");
                if (ids == "") {
                    alert("请选择学生.");
                    return;
                }
                $("#reviewDiv").html("loading...");
                $("#reviewDiv").load(appRoot + 'Admin/StudentReviewUc/?ids=' + ids + '&rd=' + rdTime());
                $("#reviewDiv").dialog("open");
            });


            $("#btnDel").click(function () {
                var ids = getCheckStr("idCheckBox", ",");
                if (ids == "") {
                    alert("请选择学生.");
                    return;
                }
                if (!confirm("确定删除?")) {
                    return;
                }
                window.location = appRoot + 'Admin/StudentDel/?ids=' + ids + '&rd=' + rdTime();
            });

            $("#btnExport").click(function () {
                //collegeIdSearch, int? subjectIdSearch, int? classIdSearch, string uidSearch, string nameSearch
                window.location = appRoot + "Admin/ExportStudent/?collegeIdSearch=" + $("#CollegeIdSearch").val() + "&departIdSearch=" + $("#DepartIdSearch").val()
                    + "&subjectIdSearch=" + $("#SubjectIdSearch").val()
                    + "&classIdSearch=" + $("#ClassIdSearch").val() + "&uidSearch=" + $("#uidSearch").val() + "&nameSearch=" + $("#nameSearch").val() + '&rd=' + rdTime();
            });
        });

        var editClickA = function (id) {
            $("#editDiv").html("loading...");
            $("#editDiv").load(appRoot + 'Admin/StudentEditUc/' + id + "?rd=" + rdTime());
            $("#editDiv").dialog("open");
        };

    </script>
</asp:Content>
